﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TaoBaoProject.Common;
using System.Collections;
using TaoBaoProject.WebModel;
using System.Data;
using Model;
using BLL;

namespace TaoBaoProject.Pages
{
  public partial class RegisterPage : BasePage
  {
    public string containsProFields
    {
      get;
      set;
    }
    public string webCurrentUserName
    {
      set;
      get;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
      containsProFields = ContextWeb.CurrentUser.ContainFileds;
      webCurrentUserName = ContextWeb.CurrentUser.UserName;
    }
    #region  导入导出功能 先隐藏了了··
    //protected void lbtnExport_Click(object sender, EventArgs e)
    //{

    //  TableCell[] header = new TableCell[26];
    //  for (int i = 0; i < header.Length; i++)
    //  {
    //    header[i] = new TableHeaderCell();
    //  }
    //  header[0].Text = "ID";
    //  header[1].Text = "QQ";
    //  header[2].Text = "旺旺";
    //  header[3].Text = "支付宝账户";
    //  header[4].Text = "支付宝名字";
    //  header[5].Text = "返款支付宝";
    //  header[6].Text = "返款支付宝名字";
    //  header[7].Text = "财付通账户";
    //  header[8].Text = "财付通名字";
    //  header[9].Text = "店铺名称";
    //  header[10].Text = "金额";
    //  header[11].Text = "手机";
    //  header[12].Text = "固定电话";
    //  header[13].Text = "收货人";
    //  header[14].Text = "收货人详细地址";
    //  header[15].Text = "收货人手机";
    //  header[16].Text = "收货人固定电话";
    //  header[17].Text = "省";
    //  header[18].Text = "市";
    //  header[19].Text = "区";
    //  header[20].Text = "银行账号";
    //  header[21].Text = "银行户名";
    //  header[22].Text = "何种银行";
    //  header[23].Text = "来源";
    //  header[24].Text = "日期";
    //  header[25].Text = "备注";
    //  DataTable registers = RegisterBLL.GetAllRegister();


    //  DataTable dttemp = new DataTable();
    //  dttemp.Columns.Add("ProID");
    //  dttemp.Columns.Add("QQ");
    //  dttemp.Columns.Add("Wangwang");
    //  dttemp.Columns.Add("ZhifubaoAccount");
    //  dttemp.Columns.Add("ZhifubaoName");
    //  dttemp.Columns.Add("RebateZhifubao");
    //  dttemp.Columns.Add("RebateZhifubaoName");
    //  dttemp.Columns.Add("CaifutongAccount");
    //  dttemp.Columns.Add("CaifutongName");
    //  dttemp.Columns.Add("ShopName");
    //  dttemp.Columns.Add("Cash");
    //  dttemp.Columns.Add("Cellphone");
    //  dttemp.Columns.Add("Fixphone");
    //  dttemp.Columns.Add("ReceiveName");
    //  dttemp.Columns.Add("ReceiveAddress");
    //  dttemp.Columns.Add("ReceiveCellphone");
    //  dttemp.Columns.Add("ReceiveFixphone");
    //  dttemp.Columns.Add("Province");
    //  dttemp.Columns.Add("City");
    //  dttemp.Columns.Add("District");
    //  dttemp.Columns.Add("BankAccount");
    //  dttemp.Columns.Add("BankName");
    //  dttemp.Columns.Add("BankType");
    //  dttemp.Columns.Add("Source");
    //  dttemp.Columns.Add("Date");
    //  dttemp.Columns.Add("Beizhu");

    //  for (int i = 0; i < registers.Rows.Count; i++)
    //  {
    //    DataRow dr = dttemp.NewRow();
    //    dr["ProID"] = registers.Rows[i]["ProID"];
    //    dr["QQ"] = registers.Rows[i]["QQ"];
    //    dr["Wangwang"] = registers.Rows[i]["Wangwang"];
    //    dr["ZhifubaoAccount"] = registers.Rows[i]["ZhifubaoAccount"];
    //    dr["ZhifubaoName"] = registers.Rows[i]["ZhifubaoName"];
    //    dr["RebateZhifubao"] = registers.Rows[i]["RebateZhifubao"];
    //    dr["RebateZhifubaoName"] = registers.Rows[i]["RebateZhifubaoName"];
    //    dr["CaifutongAccount"] = registers.Rows[i]["CaifutongAccount"];
    //    dr["CaifutongName"] = registers.Rows[i]["CaifutongName"];
    //    dr["ShopName"] = registers.Rows[i]["ShopName"];
    //    dr["Cash"] = registers.Rows[i]["Cash"];
    //    dr["Cellphone"] = registers.Rows[i]["Cellphone"];
    //    dr["Fixphone"] = registers.Rows[i]["Fixphone"];
    //    dr["ReceiveName"] = registers.Rows[i]["ReceiveName"];
    //    dr["ReceiveAddress"] = registers.Rows[i]["ReceiveAddress"];
    //    dr["ReceiveCellphone"] = registers.Rows[i]["ReceiveCellphone"];
    //    dr["ReceiveFixphone"] = registers.Rows[i]["ReceiveFixphone"];
    //    dr["Province"] = registers.Rows[i]["Province"];
    //    dr["City"] = registers.Rows[i]["City"];
    //    dr["District"] = registers.Rows[i]["District"];
    //    dr["BankAccount"] = registers.Rows[i]["BankAccount"];
    //    dr["BankName"] = registers.Rows[i]["BankName"];
    //    dr["BankType"] = registers.Rows[i]["BankType"];
    //    dr["Source"] = registers.Rows[i]["Source"];
    //    dr["Date"] = registers.Rows[i]["Date"];
    //    dr["Beizhu"] = registers.Rows[i]["Beizhu"];
    //    dttemp.Rows.Add(dr);
    //  }



    //  Dictionary<int, int> mergeCellNums = new Dictionary<int, int>();
    //  ExcelOperate.DataTable2Excel(dttemp, header, "登记信息表.xls", mergeCellNums, 0);
    //}

    //protected void lbtnImportAll_Click(object sender, EventArgs e)
    //{

    //  if (this.fAddress.FileName == "")
    //  {
    //    return;
    //  }
    //  string fileExt = System.IO.Path.GetExtension(this.fAddress.FileName);
    //  if (fileExt != ".xls" && fileExt != ".xlsx")
    //  {

    //    ClientScriptManager cs = Page.ClientScript;
    //    cs.RegisterClientScriptBlock(typeof(Object), "alert", "<Script>  jQuery.messager.alert('提示:', '请选择.xls或.xlsx文件！');</script>");
    //    return;
    //  }

    //  string FullName = ExcelOperate.GetFilePath(this.Request, this.Page);
    //  ArrayList SheetNames = ExcelOperate.GetSheetName(FullName, fileExt);  //获取xls文件的各个表名
    //  DataSet ds = ExcelOperate.SaveXlsToDataSet(FullName, SheetNames, fileExt);
    //  ExcelOperate.DeleteXlsFile(FullName);
    //  DataTable dt = ds.Tables[0];

    //  for (int i = 0; i < dt.Rows.Count; i++)
    //  {
    //    DataRow dr = dt.Rows[i];
    //    Register r = new Register();
    //    string shopname = dr["店铺"].ToString();
    //    ShopBLL sb = new ShopBLL();
    //    if (!sb.isExistShopName(shopname))
    //    {
    //      Shops s = new Shops();
    //      s.ShopName = shopname;
    //      s.ShopColor = "";
    //      sb.AddShop(s);
    //    }
    //    int shopid = sb.getShopId(shopname);

    //    r.Qq = dr["QQ号码"].ToString();
    //    r.Wangwang = dr["旺旺"].ToString();
    //    r.ZhifubaoAccount = dr["支付宝"].ToString();
    //    r.ZhifubaoName = "";
    //    r.RebateZhifubao = "";
    //    r.RebateZhifubaoName = "";
    //    r.CellPhone = "";
    //    r.ReceiveCellphone = "";
    //    r.ReceiveFixphone = "";
    //    r.Province = "";
    //    r.City = "";
    //    r.District = "";
    //    r.BankType = "";
    //    r.Source = "";
    //    r.CaifutongAccount = dr["财付通"].ToString();
    //    r.CaifutongName = "";
    //    r.Date = dr["日期"].ToString();
    //    r.Cash = dr["金额"].ToString();
    //    r.ShopId = shopid;
    //    r.Beizhu = dr["备注"].ToString();
    //    r.BankAccount = dr["银行卡号"].ToString();
    //    r.BankName = dr["银行户名"].ToString();
    //    r.CreatedBy = dr["操作人员"].ToString();

    //    r.FixPhone = dr["电话"].ToString();
    //    r.ReceiveName = dr["名字"].ToString();
    //    r.ReceiveAddress = dr["地址"].ToString();
    //    try
    //    {
    //      RegisterBLL.AddRegister(r);
    //    }
    //    catch (Exception)
    //    {
    //    }

    //  }
    //  ClientScriptManager csm = Page.ClientScript;
    //  csm.RegisterClientScriptBlock(typeof(Object), "alert", "<Script>  jQuery.messager.alert('提示:', '导入成功！');</script>");
    //}
    //protected void lbtnImport_Click(object sender, EventArgs e)
    //{
    //  if (this.fAddress.FileName == "")
    //  {
    //    return;
    //  }
    //  string fileExt = System.IO.Path.GetExtension(this.fAddress.FileName);
    //  if (fileExt != ".xls" && fileExt != ".xlsx")
    //  {

    //    ClientScriptManager cs = Page.ClientScript;
    //    cs.RegisterClientScriptBlock(typeof(Object), "alert", "<Script>  jQuery.messager.alert('提示:', '请选择.xls或.xlsx文件！');</script>");
    //    return;
    //  }

    //  string FullName = ExcelOperate.GetFilePath(this.Request, this.Page);
    //  ArrayList SheetNames = ExcelOperate.GetSheetName(FullName, fileExt);  //获取xls文件的各个表名
    //  DataSet ds = ExcelOperate.SaveXlsToDataSet(FullName, SheetNames, fileExt);
    //  ExcelOperate.DeleteXlsFile(FullName);
    //  DataTable dt = ds.Tables[0];

    //  for (int i = 0; i < dt.Rows.Count; i++)
    //  {
    //    DataRow dr = dt.Rows[i];
    //    Register r = new Register();

    //    r.Wangwang = dr["买家账号"].ToString();
    //    r.ReceiveAddress = dr["详细地址"].ToString();
    //    r.Province = dr["省"].ToString().Trim();
    //    r.City = dr["市"].ToString().Trim();
    //    r.District = dr["区"].ToString().Trim();

    //    DataTable dttemp = RegisterBLL.GetRegister("Wangwang", r.Wangwang);
    //    if (dttemp.Rows.Count > 0)
    //    {
    //      if (string.IsNullOrEmpty(dttemp.Rows[0]["ReceiveAddress"].ToString()) && string.IsNullOrEmpty(dttemp.Rows[0]["Province"].ToString()) && string.IsNullOrEmpty(dttemp.Rows[0]["City"].ToString()) && string.IsNullOrEmpty(dttemp.Rows[0]["District"].ToString()))
    //      {
    //        RegisterBLL.UpdateRegister(r, "Wangwang", r.Wangwang);
    //      }

    //    }


    //  }
    //}
    #endregion

  }
}